package work_two;

import java.util.Scanner;

public class testTwo {
    public static void main(String[] args) {
        System.out.println("请输入一组整数数组，每个数值间用逗号分隔开");
        Scanner scan = new Scanner(System.in);
        String[] str = scan.next().toString().split(",");
        int[] nums = new int[str.length];
        for(int i=0;i<str.length;i++)
            nums[i]= Integer.parseInt(str[i]);

        int max=0,s=0,smax=0;
        for(int i=0;i<nums.length;i++) {
            s=nums[i];
            max=nums[i];
            for (int j = i + 1; j < nums.length; j++) {
                s += nums[j];
                if(s>max)
                    max=s;
            }
            if(smax<max)
                smax=max;
        }
        System.out.println("该整数数组中子数组之和的最大值为："+smax);

    }
}
